//


import UIKit
//import CLToast

class WP_FeedbackViewController: WP_BasicViewController,UITextViewDelegate {
    
    var wptextView:UITextView!
    var wpplaceLabel:UILabel!
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setNavTitle("Feedback")
        // Do any additional setup after loading the view.
        
        setUI()
    }
    
    func setUI() {
        
        wptextView = UITextView.init(frame: CGRect(x: 12, y: kNavBarHeight+10, width: kScreenWidth-24, height: 200))
        wptextView.textColor = UIColorFromHex(0x7B68EE)
        wptextView.font = FontPFRegular(18)
        wptextView.delegate = self
        self.view.addSubview(wptextView)
        
        wpplaceLabel = UILabel.init(frame: CGRect(x: 5, y: 10, width: 200, height: 20))
        wpplaceLabel.textColor = UIColorFromHex(0xBEBEBE)
        wpplaceLabel.font = FontPFRegular(18)
        wpplaceLabel.text = "Type in what you want to say"
        wptextView.addSubview(wpplaceLabel)
        
        let btn = UIButton.init(frame: CGRect(x: 48, y: wptextView.frame.maxY+30, width: kScreenWidth-96, height: 40))
        btn.setTitle("Submit", for: .normal)
        btn.setTitleColor(UIColor.white, for: .normal)
        btn.backgroundColor = UIColorFromHex(0xFFD700)
        btn.layer.cornerRadius = 8
        btn.addTarget(self, action: #selector(Click), for: .touchUpInside)
        self.view.addSubview(btn)
        
    }
    func textViewDidChange(_ textView: UITextView) {
        wpplaceLabel.text = ""
        if textView.text.count == 0 {
            wpplaceLabel.text = "Type in what you want to say"
        }
        
    }
    //
    @objc func Click() {
        if wptextView.text.count <= 0 {
//            CLToast.cl_show(msg: "The content cannot be empty")
            showMessage("The content cannot be empty", self.view)
            return
        }
        self.navigationController?.popViewController(animated: true)
    }
    
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     // Get the new view controller using segue.destination.
     // Pass the selected object to the new view controller.
     }
     */
    
}
